<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent">
    <div
      class="content-parent border-hover-style"
      :style="{
        backgroundImage: `url(${publicUrls + 'free/style7/Auxiliaryoutlinestyle2Bg.webp'})`,
      }"
    >
      <div class="audio-parent">
        <audioCom :info="props.info" ref="audioParent" />
      </div>

      <div
        class="content"
        :class="{
          content2:
            !props.info.remarks &&
            !props.info.subTitle &&
            !(props.info.video && props.info.video.url) &&
            !props.info.value,
        }"
      >
        <div
          class="title-box"
          :class="{
            'title-box-2': !((props.info.video && props.info.video.url) || props.info.value),
          }"
        >
          {{ props.info.text }}
        </div>
        <div class="btm-box">
          <div
            v-if="(props.info.video && props.info.video.url) || props.info.value"
            class="img-box"
            :class="{
              'img-box1': props.info.remarks && props.info.subTitle,
              'img-box2': props.info.remarks && !props.info.subTitle,
              'img-box3': !props.info.remarks && props.info.subTitle,
              'img-box4': !props.info.remarks && !props.info.subTitle,
            }"
          >
            <videoview
              @click="audioplay(false)"
              :info="props.info"
              v-if="props.info.video && props.info.video.url"
            ></videoview>
            <div v-else class="outline-cover">
              <img @click="ImgVisible = true" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
            </div>
          </div>
          <div
            v-if=" props.info.subTitle || props.info.remarks"
            class="btm-right"
            :class="{ 'btm-right-max': !((props.info.video && props.info.video.url) || props.info.value) }"
          >
            <p class="subtitle" v-if="props.info.subTitle">——{{ props.info.subTitle }}</p>
            <div
              class="remarks1"
              :class="{ remarks4: !props.info.subTitle }"
              v-if="(props.info.video && props.info.video.url) || props.info.value"
            >
              <TextMax
                :color2="false"
                :infoData="props.info"
                v-if="props.domShow"
                :data="props.info.remarks"
                :title="props.info.text"
                :row="props.info.subTitle ? 6 : 8"
              ></TextMax>
            </div>
            <div class="remarks2" :class="{ remarks3: !props.info.subTitle }" v-else-if="props.info.remarks">
              <TextMax
                :color2="false"
                :infoData="props.info"
                v-if="props.domShow"
                :data="props.info.remarks"
                :title="props.info.text"
                :row="props.info.subTitle ? 7 : 7"
              ></TextMax>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>



<script setup lang="ts">
import audioCom from './audioCom.vue';
import { publicUrls, textType } from '@/utils/minxin';
import { useProjectStore } from '@/store';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/textMax7.vue';
import videoview from './../../../videoDialog/videoview.vue';

const props = defineProps({
  info: {
    type: Object,
  },
  domShow: {
    type: Boolean,
  },
});

const ImgVisible = ref(false);
const audioRef = ref(null);
const audioParent = ref(null);
const videoRef = ref(null);
const isPlay = ref(false);
const store = useProjectStore();
const audioplay = (flag: boolean = true) => {
  audioParent.value.videoplay();
};
</script>

<style scoped lang="less">
.outline-parent {
  display: flex;
  // align-items: flex-end;
  position: relative;
  margin-top: 0;
  height: 100%;
  margin-right: 140px;
}
.content-parent {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-top: 90px;
  width: 610px;
  height: 400px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-box-reflect: below 34% linear-gradient(transparent, rgba(0, 0, 0, 0.15));
}
.audio-parent {
  position: absolute;
  top: 11px;
  right: 40px;
  width: 32px;
  height: 32px;
}
.content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 610px;
  height: 400px;
  padding: 0 40px;
}
.content2 {
  // justify-content: center;
}
.title-box {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 356px;
  height: 50px;
  font-family: SourceBold;
  font-size: 20px;
  color: rgba(112, 157, 134, 1);
  line-height: 30px;
  text-align: center;
  margin-top: 2px;
}
.title-box-2 {
}
.btm-box {
  display: flex;
  width: 100%;
  margin-top: 47px;
}
.btm-right {
  display: flex;
  flex-direction: column;
  margin-left: 20px;
  width: 280px;
}
.btm-right-max {
  width: 100%;
  // width: 230px;
  margin-left: 0;
}
.subtitle {
  width: 100%;
  font-family: SourceMedium;
  font-size: 16px;
  color: rgba(51, 51, 51, 1);
  line-height: 28px;
  text-align: center;
}
.img-box {
  margin-top: 12px;
  position: relative;
  overflow: hidden;
  background: rgba(232, 225, 212, 1);
  width: 440px;
  height: 130px;
  :deep(video) {
    background: rgba(232, 225, 212, 1);
  }
  .outline-cover {
    width: 100%;
    height: 100%;
    object-fit: contain;
    overflow: hidden;
    img {
      transition: all 0.3s;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
  }
}
.img-box:hover {
  .outline-cover {
    img {
      transform: scale(1.2);
    }
  }
}
.img-box1 {
  width: 230px;
  height: 250px;
}
.img-box2 {
  width: 230px;
  height: 250px;
}
.img-box3 {
  width: 230px;
  height: 250px;
}
.img-box4 {
  width: 530px;
  height: 250px;
  margin-top: 7px;
}

.remarks1 {
  margin-top: 12px;
  width: 100%;
  :deep(.van-text-ellipsis) {
  }
}
.remarks4 {
  width: 100%;
  margin-top: 0px;
}
.remarks2 {
  margin-top: 12px;
  width: 100%;
}
.remarks3 {
  width: 100%;
  margin-top: 0px;
}
</style>
